#ifndef SQLEDITDIALOG_H
#define SQLEDITDIALOG_H

#include <QDialog>

namespace Ui {
class SqlEditDialog;
}

class DataObj;
class CityData;
class PersonData;
class KnightData;
class QSqlRelationalTableModel;
class SqlEditDialog : public QDialog
{
    Q_OBJECT
    
public:
    static SqlEditDialog *getInstance();
    ~SqlEditDialog();
    void deleteInstance();

    void InitDialog();

    CityData *getCityData(int index);
    PersonData *getPersonData(int index);
    KnightData *getKnightData(int index);

    void freeData(DataObj *obj);

private:
    explicit SqlEditDialog(QWidget *parent = 0);
    
private slots:
    void on_pushButtonCheck_clicked();

    void on_pushButtonDisplayAll_clicked();

    void on_pushButtonAddRow_clicked();

    void on_pushButtonDelRow_clicked();

    void on_pushButtonSubmit_clicked();

    void on_pushButtonUndo_clicked();

    void on_comboBox_currentIndexChanged(const QString &arg1);

private:
    static SqlEditDialog* instance;
    QString curTable;
    Ui::SqlEditDialog *ui;
    QSqlRelationalTableModel *curModel;
    QSqlRelationalTableModel *mdPerson;
    QSqlRelationalTableModel *mdCity;
};

#endif // SQLEDITDIALOG_H
